<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>轩辕短信平台</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Place your description here" />
<meta name="keywords" content="put, your, keyword, here" />
<meta name="author" content="cssMoban.com - website templates provider" />
<link href="style.css" rel="stylesheet" type="text/css" />
<!--  
-->
<link href="css/validator.css" rel="stylesheet" type="text/css" />



</head>

<body id="page5">
<div class="tail-top-left"></div>
<div class="tail-top">
<!-- header -->
	<div id="header">
		<div class="row-1">
			<div class="fleft"><a href="index.html"><img src="images/logo.gif" alt="" /></a></div>
			<div class="fright">
				<ul>
					<li><a href="indexAction"><b>主页</b></a></li>
					<li><a href="seeUserAction" class="active"><b>用户管理</b></a></li>
					<li><a href="sendMessageAction"><b>短信平台</b></a></li>
					<li><a href="updateByPersonAction"><b>个人信息管理</b></a></li>
					<li><a href="aboutUsAction"><b>关于我们</b></a></li>
				</ul>
			</div>
		</div>
	</div>
<!-- content -->
	<div id="content"><div class="inner_copy">More <a href="http://www.cssmoban.com/">Website Templates</a> at TemplateMonster.com!</div>
		<div class="row-1">
			<div class="inside">
				<div class="container">
					<div class="aside">
						<h3 style="font-size:28px;hine-height:1.2em;text-align:left;"'> 功能 </h3>
						<ul>
							        <li>
										<img src="images/pic1.gif" alt="" />
										<div class="extra-wrap">
											<span style="width: 80px"><a href="seeUserAction">用户列表</a> </span>
										</div>
									</li>
									<li>
										<img src="images/pic2.gif" alt="" />
										<div class="extra-wrap">
											<span style="width: 80px"><a href="selectUserAction">用户查询</a> </span>
										</div>
									</li>
									<li>
										<img src="images/pic3.gif" alt="" />
										<div class="extra-wrap">
											<span style="width: 80px"><a href="addUserAction">用户添加</a> </span>
										</div>
									</li>
									
									<li>
										<img src="images/pic5.gif" alt="" />
										<div class="extra-wrap">
											<span style="width: 80px"><a href="updatePassAction">修改密码</a> </span>
										</div>
									</li>
						</ul>
					</div>
					<div class="content">
						<h3>添加用户</h3>
						<div class="txt3">
                         <form id="validator-form" action="javascript:addUser()">
     <fieldset class="field-wrap">
	     <div class="field-item">
          <label for="username">用&nbsp;户&nbsp;&nbsp;名：</label><input id="username" name="username" class="input-item" type="text" maxlength="20" /></div>
         <div class="field-item"><label for="password">登录密码：</label><input id="password" name="password" class="input-item" type="password" maxlength="20" /></div>
         
	     <div class="field-item"><label for="confirm-password">确认密码：</label><input id="confirm-password" class="input-item" name="confirm-password" maxlength="20" type="password" /></div>
		  <div class="field-item">
          <label for="username">真实姓名：</label><input id="realname" name="realname" class="input-item" type="text" maxlength="20" /></div>
		 
         <div class="field-item"><label for="department">所属部门：</label><input id="department" name="department" class="input-item" type="text" maxlength="20" /></div>
		 <div class="field-item"><label for="email">电子邮箱：</label><input id="email" name="email" type="text" class="input-item" /></div>
		 <div class="field-item"><label for="mobile">手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机：</label><input id="mobile" name="mobile" type="text" class="input-item" maxlength="11" /></div>
		<div class="field-item center"><div><table><tr><td width="73%"></td><td width="73%"><input type="submit" value="添加" style="width:80px;height:33px;border:1px solid #DCDCDC;background:#518d08;float:100px;" /></td></tr></table></div>
											</div>
	 </fieldset>
     </form>
</div>
					</div>
					<div class="clear"></div>
				</div>
			</div>
		</div>
	<div class="tail-middle">
			<div class="row-2">
				<div class="inside">
					
					<div class="indent">
						<div class="box1">
							<div class="border-top">
								<div class="border-bot">
									<div class="left-top-corner">
										<div class="right-top-corner">
											<div class="right-bot-corner">
												
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<!-- footer -->
	<div id="footer">
		<div class="footer">
					版权所有 广东轩辕网络科技股份有限公司 电话：020-85285889 传真：020-85285329
				</div>
	</div>
</div>
</body>
</html>
<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<script type='text/javascript' src='dwr/interface/userAction.js'></script>
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="js/jcarousellite.js" type="text/javascript"></script>
<script type="text/javascript" src="js/yui.js"></script>
<script type="text/javascript" src="js/yui.validator.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
	  $("a.new_window").attr("target", "_blank");
	});
	
	function addUser(){
	  var userName = $("#username").val();
	  var password = $("#password").val();
	  var department = $("#department").val();
	  var email = $("#email").val();
	  var realName = $("#realname").val();
	  var mobile = $("#mobile").val();
	  if(userName != "" && password != "" && department != "" && email != "" && 
	     realName != "" && mobile != ""){
	  userAction.addUser(userName,password,department,email,mobile,function(data){
	     alert("添加成功!");
	  });
	  }
	}
	
	/*表单验证 */
(function(){	
	    Validator = YUI.Validator, 
    $("#username").keyup(
        function(){
           var name = $("#username").val();
		userAction.selectUser(name,function(data){
		        var flag = false;
		          if(data == null){
		            flag = true;
		          } else {
		            flag = false;
		          }
		          
	    Validator.setup({
		"form": "validator-form"
	}).add({
	    "target": "username",
		"rule": "username",
		"fn": function(){
		    return flag;
		}
	}).add({
		"target": "password",
		"rule": "password",
		"plus": true
		
	}).add({
		"target": "confirm-password",
		"rule": "password",
        "to": "password" 
	}).add({
		"target": "realname",
		"rule": "require"
	}).add({
		"target": "department",
		"rule": "require"
	}).add({
		"target": "email",
		"rule": "email"
	}).add({
		"target": "mobile",
		"rule": "mobile"
	});       
		         
		    }); 
        }
    ).trigger("keyup");
})();	

</script>
